﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Controls.Common="clr-namespace:Imagin.Controls.Common;assembly=Imagin.Controls.Common">
    <Style x:Key="{x:Type Button}" TargetType="{x:Type Button}">
        <Setter Property="Background" Value="{DynamicResource Brush.Button.Background}" />
        <Setter Property="BorderBrush" Value="{DynamicResource Brush.Button.Border}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="Cursor" Value="Hand" />
        <Setter Property="Foreground" Value="{DynamicResource Brush.Button.Foreground}" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="25,5" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Border 
                        Background="{TemplateBinding Background}" 
                        BorderBrush="{TemplateBinding BorderBrush}" 
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Padding="{TemplateBinding Padding}">
                        <ContentPresenter 
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" 
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.Button.MouseOver.Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Button.MouseOver.Border}" />
            </Trigger>
            <Trigger Property="IsPressed" Value="True">
                <Setter Property="Background" Value="{DynamicResource Brush.Button.MouseDown.Background}" />
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Button.MouseDown.Border}" />
                <Setter Property="Foreground" Value="{DynamicResource Brush.Button.MouseDown.Foreground}" />
            </Trigger>
            <Trigger Property="IsCancel" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Button.Cancel.Border}" />
            </Trigger>
            <Trigger Property="IsDefault" Value="True">
                <Setter Property="BorderBrush" Value="{DynamicResource Brush.Button.Default.Border}" />
            </Trigger>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.8" />
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{x:Type Controls.Common:TokenButton}" TargetType="{x:Type Controls.Common:TokenButton}" BasedOn="{StaticResource {x:Type Button}}">
        <Setter Property="ContentTemplate">
            <Setter.Value>
                <DataTemplate>
                    <TextBlock Text="{Binding Mode=OneWay}"/>
                </DataTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="Margin" Value="0,0,5,5"/>
        <Setter Property="Padding" Value="6,4"/>
    </Style>
</ResourceDictionary>